package com.bdqn.zhang.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

/**
 * <Description> <br>
 *
 * @author tao<br>
 * @version 1.0<br>
 * @taskId: <br>
 * @createDate 2019/10/17 17:36 <br>
 * @see com.bdqn.zhang.pojo <br>
 */
@Entity
@Table(name="studenttb")
@Data
public class Student implements Serializable {
    @Id //实体类的主键
    //@GeneratedValue //自动增长列
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @OrderBy //数据加载顺序
    @Column(columnDefinition = "int unsigned NOT NULL comment '备注:学生自动增长主键' ")
    private Integer studentId;
    @Column(length = 20) //字符长度20
    private String studentName;
    @Column(columnDefinition = "char(1) comment '备注:学生姓名' ")
    private String studentSex;
    @Column(columnDefinition = "int unsigned DEFAULT 0 comment '备注:学生年龄' ")
    private Integer studentAge;
    private Date studentBirthday;
    // @CreationTimestamp@UpdateTimestamp //插入,修改时自动维护时间戳
    @Column(columnDefinition = "TIMESTAMP", nullable = false, updatable = false, insertable = false)
    private Timestamp updateTime;
    @Transient //临时参数,不映射到数据库表字段
    private String studentSpare;
    @JsonIgnore
    @ManyToOne(targetEntity = Clazz.class)
    @JoinColumn(name = "student_clazz_id") //副表中的外键字段名称
    private Clazz clazz;
}
